home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1996 / MacHack 1996.toast / Hacks / Hacks ’92 / Scroll O Rama / CallBack.ƒ / Scroll Call Back.c < prev    next >
C/C++ Source or Header  |  1991-07-10  |  786b  |  38 lines

  1. /*    This is the source code for the SBCB code resource used by the scroll    */
  2. /*    bars in SBar.c.  There isn't anything special about the routine, it        */
  3. /*    just has to be stored as a code resource so that it can be loaded by     */
  4. /*    cdev.                                                                    */
  5.  
  6.  
  7. #define    DelayTime    9
  8.  
  9. pascal void main(ControlHandle theControl, int theCode)
  10. {
  11.     int     theCV, maxCV, minCV;
  12.     long    dummy;
  13.     
  14.     maxCV = GetCtlMax(theControl);
  15.     theCV = GetCtlValue(theControl);
  16.     minCV = GetCtlMin(theControl);
  17.     
  18.     switch(theCode)
  19.     {
  20.         case inPageDown:
  21.         case inDownButton:
  22.             if (theCV < maxCV)
  23.                 {
  24.                     theCV += 1;
  25.                     Delay(DelayTime, &dummy);
  26.                 }
  27.             break;
  28.         case inPageUp:
  29.         case inUpButton:
  30.             if (theCV > minCV)
  31.                 {
  32.                     theCV -= 1;
  33.                     Delay(DelayTime, &dummy);
  34.                 }
  35.     }
  36.     SetCtlValue(theControl, theCV);
  37. }
  38.